<?php
class Application_Model_DbTable_Project extends Zend_Db_Table_Abstract
{
    protected $_name = 'dia_project';
    
    public function getProject($id) 
    {
        $id = (int)$id;
        $row = $this->fetchRow('id = ' . $id);
        if (!$row) {
            throw new Exception("Count not find row $id");
        }
        return $row->toArray();    
    }
    
/*    public function addProject( $title,$type,$alils,$picture1,$picture2,$projectDetail,$projectStartDatetime,$createByID,$csrCount,$currentStatus,$attach1,$attach2)
    {
        $data = array(
            'title' => $title,
            'type' => $type,
            'alils' => $alils,
            'picture1' => $picture1,
            'picture2' => $picture2,
            'projectDetail'=> $projectDetail,
            'projectStartDatetime'=> $projectStartDatetime,
            'createByID'=> $createByID,
            'csrCount'=> $csrCount,
            'currentStaus'=> $currentStatus,
            'attach1'=> $attach1,
            'attach2'=> $attach2,
        );
        $this->insert($data);
    }
*/    
    public function updateProject($id,$title,$type)
    {
        $data = array(
            'title' => $title,
            'type' => $type,
            /*   ,$type,$alils,$picture1,$picture2,$projectDetail,$projectStartDatetime,$createByID,$csrCount,$currentStatus,$attach1,$attach2            
            'alils' => $alils,
            'picture1' => $picture1,
            'picture2' => $picture2,
            'projectDetail'=> $projectDetail,
            'projectStartDatetime'=> $projectStartDatetime,
            'createByID'=> $createByID,
            'csrCount'=> $csrCount,
            'currentStaus'=> $currentStatus,
            'attach1'=> $attach1,
            'attach2'=> $attach2, */
        );
        $this->update($data, 'id = '. (int)$id);
    }
    
    public function deleteProject($id)
    {
        $this->delete('id =' . (int)$id);
    }

}

